import java.util.Scanner;

public class Main1217 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int x=sc.nextInt();
        int y=sc.nextInt();
        int[] arr=new int[n];
        int[] arr1=new int[arr.length+1];
        for (int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int a=0;
        for (int j=0;j<n;j++){
            if (arr[j]==x){
                a=j;
            }
        }
       // System.out.println(a);
        for (int i=0;i<arr.length;i++){
            arr1[i]=arr[i];
        }
        for(int i=arr1.length-1;i>a+1;i--){
            arr1[i]=arr1[i-1];
        }
        arr1[a+1]=y;
        arr=arr1;
        for (int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
    }
}
